home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************
- * gonio.h *
- * *
- * Sin (x,multiplication) (see below) *
- * Cos (x,multiplication) (see below) *
- * *
- *==============================================================*
- * *
- *name date Author Comment *
- * *
- *gon1 24Mar91 KvGend created it for a integer-compiler. *
- * *
- * *
- ****************************************************************/
-
-
- int sintabel[] =
- {
- /* 0 : */ 0,
- /* 1 : */ 6,
- /* 2 : */ 12,
- /* 3 : */ 19,
- /* 4 : */ 24,
- /* 5 : */ 30,
- /* 6 : */ 36,
- /* 7 : */ 41,
- /* 8 : */ 45,
- /* 9 : */ 49,
- /* 10 : */ 53,
- /* 11 : */ 56,
- /* 12 : */ 59,
- /* 13 : */ 61,
- /* 14 : */ 63,
- /* 15 : */ 64,
- /* 16 : */ 64,
- /* 17 : */ 64,
- /* 18 : */ 63,
- /* 19 : */ 61,
- /* 20 : */ 59,
- /* 21 : */ 56,
- /* 22 : */ 53,
- /* 23 : */ 49,
- /* 24 : */ 45,
- /* 25 : */ 41,
- /* 26 : */ 36,
- /* 27 : */ 30,
- /* 28 : */ 24,
- /* 29 : */ 19,
- /* 30 : */ 12,
- /* 31 : */ 6,
- /* 32 : */ 0,
- /* 33 : */ -6,
- /* 34 : */ -12,
- /* 35 : */ -19,
- /* 36 : */ -24,
- /* 37 : */ -30,
- /* 38 : */ -36,
- /* 39 : */ -41,
- /* 40 : */ -45,
- /* 41 : */ -49,
- /* 42 : */ -53,
- /* 43 : */ -56,
- /* 44 : */ -59,
- /* 45 : */ -61,
- /* 46 : */ -63,
- /* 47 : */ -64,
- /* 48 : */ -64,
- /* 49 : */ -64,
- /* 50 : */ -63,
- /* 51 : */ -61,
- /* 52 : */ -59,
- /* 53 : */ -56,
- /* 54 : */ -53,
- /* 55 : */ -49,
- /* 56 : */ -45,
- /* 57 : */ -41,
- /* 58 : */ -36,
- /* 59 : */ -30,
- /* 60 : */ -24,
- /* 61 : */ -19,
- /* 62 : */ -12,
- /* 63 : */ -6,
- /* 64 : */ 0}; /* end-of sintabel[] */
-
-
-
-
-
- /* normal maths:
- * y= 25*sin(x) x:[0,2ΒΆ>
- *
- * my routine:
- * y= Sin(x,25) x:[0,64>
- */
-
- int
- Sin (int in, int mult)
- {
- return ((mult * sintabel[in &63]) >> 6);
- }
-
- /* tough eh?
- * easy:
- * take the modulo of in,(in is 0 up to and including 63)
- * then look it up in the sinetable (???)
- * multiply it with mult,
- * divide it by 64,
- * return it.
- */
-
-
- int
- Cos (int in, int mult)
- {
- return ((mult * sintabel[(in +16) &63]) >> 6);
- }
-